package com.macro.mall.controller;

import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.BasicUserPortraitParam;
import com.macro.mall.service.SysUserPortraitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("sys/userPortrait")
public class SysUserPortraitController {

    @Autowired
    private SysUserPortraitService userPortraitService;


    /***
     * 新增用户画像
     * @param param
     * @return
     */
    @PostMapping
    public CommonResult add(@RequestBody BasicUserPortraitParam param) {
        return userPortraitService.edit(param);
    }


    /***
     * 修改用户画像
     * @param param
     * @return
     */
    @PutMapping
    public CommonResult edit(@RequestBody BasicUserPortraitParam param) {
        return userPortraitService.edit(param);
    }

    /***
     * 删除用户画像
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public CommonResult delete(@PathVariable(value = "id") String id) {
        return userPortraitService.delete(id);
    }

    /***
     * 查询用户画像
     * @param param
     * @return
     */
    @GetMapping
    public CommonResult getList(BasicUserPortraitParam param) {
        return userPortraitService.getList(param);
    }

    @GetMapping("/{id}")
    public CommonResult getOne(@PathVariable(value = "id") String id) {
        return userPortraitService.getOne(id);
    }

}
